Skip to content

Conversation

@ooctipus
Copy link
Collaborator

@ooctipus ooctipus commented Oct 22, 2025

Description

This PR ensures all imports follows the string import style.
String import style avoid pulling of unnecessary packages that is related to other environments, this pr makes sure all environments are using this import.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@ooctipus ooctipus requested review from michaellin6 and peterd-NV and removed request for Mayankm96 and kellyguo11 October 22, 2025 23:25
@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 22, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR standardizes Gymnasium environment registration across the IsaacLab codebase by converting all direct imports to string-based lazy imports. The changes affect environment registration files in direct/ workflows (factory, forge) and manager_based/ manipulation tasks (lift, pick_place, stack). Instead of importing environment classes and configuration objects directly at module load time, the code now uses f-string interpolations with __name__ (e.g., f"{__name__}.factory_env:FactoryEnv") as entry points. This pattern defers actual module loading until gym.make() is called, preventing unnecessary dependency loading and improving import performance. The change follows Gymnasium's standard registration pattern and aligns with the existing architecture where environment configurations are resolved at instantiation time rather than registration time.

PR Description Notes:

  • Checkbox formatting inconsistency: Line with "I have made corresponding changes to the documentation" has [] instead of [ ]

Potential Issues

  1. Critical: Incorrect CHANGELOG date - The changelog entry for version 0.11.2 is dated 2025-10-22, which is in the future. This should be corrected to the actual release date (likely 2024-10-22 based on surrounding entries).

  2. Robomimic configuration path format change - In stack/config/franka/__init__.py and other files, the robomimic_bc_cfg_entry_point changed from filesystem paths using os.path.join(agents.__path__[0], "robomimic/bc.json") to module-style paths f"{agents.__name__}:robomimic/bc.json". This assumes the framework can resolve JSON file paths using the module:resource syntax with colon separators. If the robomimic integration expects actual filesystem paths rather than module references, this could cause runtime failures when trying to load BC policies. This should be verified with tests.

  3. Missing verification for string-based resource loading - The PR changes resource references (especially for JSON configuration files) from filesystem paths to string-based module references. While this works for Python classes via import mechanisms, JSON files require special handling (likely through importlib.resources or similar). The codebase should have mechanisms to resolve these string references to actual file paths at runtime.

Confidence Score

3/5 - The code changes are mechanically correct and follow a clear pattern, but there are concerns about the robomimic configuration path format change and the incorrect changelog date. The lack of tests mentioned in the checklist is also concerning for validating that string-based resource loading works correctly for non-Python files (JSON configs). The pattern is sound for Python class imports, but the JSON file path changes need verification.

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ooctipus ooctipus moved this to In review in Isaac Lab Oct 22, 2025
@Mayankm96 Mayankm96 changed the title Fixes all the direct environment import in gym registration to string-style import Registers direct environments to Gymnasium as string-style import Oct 25, 2025
@michaellin6
Copy link
Contributor

@ooctipus sorry for the delayed review on this. Now that Isaac Lab 2.3 has been merged to main, it would be good to rebase and make the modifications in the new environments that were introduced. Unfortunately, I realized that we won't be able to get rid of --enable-pinocchio it is needed in the mimic scripts to load pinocchio before Isaac Sim is loaded so the pinocchio in Isaac Lab is used instead of Isaac Sim.

Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

converted environment registrations from direct imports to string-style imports (e.g., f"{__name__}.module:Class") to enable lazy loading and avoid pulling unnecessary dependencies

Key changes:

  • removed direct imports of environment classes and configs across factory, forge, lift, stack, and pick_place modules
  • converted entry_point and env_cfg_entry_point to use f"{__name__}.module:ClassName" pattern
  • converted robomimic_bc_cfg_entry_point from os.path.join(agents.__path__[0], "file.json") to f"{agents.__name__}:file.json" pattern
  • removed os module imports where no longer needed

Critical issue:

  • pick_place/__init__.py:55 uses os.path.join after removing the os import, will cause NameError

Confidence Score: 1/5

  • critical runtime error in pick_place module will break environment registration
  • the incomplete conversion in pick_place/__init__.py removed the os import but left os.path.join on line 55, causing immediate NameError when the module is imported - this breaks the Isaac-PickPlace-G1-InspireFTP-Abs-v0 environment registration
  • source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/pick_place/init.py must be fixed before merge

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab_tasks/isaaclab_tasks/direct/factory/init.py 5/5 converted three environment registrations to use string-style imports consistently, removing direct imports of FactoryEnv and config classes
source/isaaclab_tasks/isaaclab_tasks/direct/forge/init.py 5/5 converted three environment registrations to use string-style imports consistently, removing direct imports of ForgeEnv and config classes
source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/lift/config/franka/init.py 5/5 converted robomimic_bc_cfg_entry_point to string-style import and removed os import
source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/pick_place/init.py 0/5 incomplete conversion - removed os import but line 55 still uses os.path.join, causing NameError at runtime
source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/stack/config/franka/init.py 5/5 converted all environment registrations to string-style imports, removing direct imports of config modules and os import

Sequence Diagram

sequenceDiagram
    participant User
    participant Gymnasium
    participant Registry
    participant ParseCfg
    participant Module
    
    User->>Gymnasium: gym.make("Isaac-Factory-PegInsert-Direct-v0")
    Gymnasium->>Registry: lookup environment spec
    Registry->>Registry: get entry_point string<br/>"isaaclab_tasks.direct.factory.factory_env:FactoryEnv"
    Registry->>Module: import module (lazy)
    Module-->>Registry: FactoryEnv class
    Registry->>Registry: get env_cfg_entry_point string<br/>"isaaclab_tasks.direct.factory.factory_env_cfg:FactoryTaskPegInsertCfg"
    Registry->>ParseCfg: load_cfg_from_registry()
    ParseCfg->>ParseCfg: split on ':' to get module:attr
    ParseCfg->>Module: importlib.import_module(module)
    Module-->>ParseCfg: module object
    ParseCfg->>ParseCfg: getattr(module, attr)
    ParseCfg-->>Registry: config class
    Registry->>Gymnasium: instantiate environment
    Gymnasium-->>User: environment instance
Loading

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

…n/pick_place/__init__.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

converted gymnasium environment registrations from direct imports to string-style entry points to avoid unnecessary package loading.

  • removed direct imports of environment config modules
  • changed env_cfg_entry_point from direct class references to module:ClassName string format
  • replaced os.path.join with module:file/path.json format for config file references
  • removed unused os import
  • applied changes to all 5 environment registrations in the file

Confidence Score: 5/5

  • safe to merge - follows established pattern across codebase
  • changes are consistent with the same pattern used in other manipulation tasks (stack, lift). the string import format is properly supported by the framework's load_cfg_from_registry function which handles colon-separated module:attribute and module:file/path formats
  • no files require special attention

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/pick_place/init.py 5/5 converted all gym registrations to use string-style imports, properly removed os import and replaced os.path.join with colon-separated module:file format

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant Gym as Gymnasium Registry
    participant Loader as load_cfg_from_registry
    participant Module as Config Module
    
    App->>Gym: gym.make("Isaac-PickPlace-GR1T2-Abs-v0")
    Gym->>Gym: lookup registration kwargs
    Note over Gym: env_cfg_entry_point:<br/>"...pick_place.pickplace_gr1t2_env_cfg:PickPlaceGR1T2EnvCfg"<br/>robomimic_bc_cfg_entry_point:<br/>"...pick_place.agents:robomimic/bc_rnn_low_dim.json"
    
    Gym->>Loader: load_cfg_from_registry(task, "env_cfg_entry_point")
    Loader->>Loader: parse string "module:attribute"
    Loader->>Module: importlib.import_module("...pickplace_gr1t2_env_cfg")
    Module-->>Loader: module object
    Loader->>Module: getattr(module, "PickPlaceGR1T2EnvCfg")
    Module-->>Loader: PickPlaceGR1T2EnvCfg class
    Loader-->>Gym: config object
    
    Gym->>Loader: load_cfg_from_registry(task, "robomimic_bc_cfg_entry_point")
    Loader->>Loader: parse string "module:file/path.json"
    Loader->>Module: importlib.import_module("...pick_place.agents")
    Module-->>Loader: agents namespace package
    Loader->>Loader: os.path.join(module.__file__, "robomimic/bc_rnn_low_dim.json")
    Loader-->>Gym: json config file path
    
    Gym-->>App: environment instance
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kellyguo11 kellyguo11 merged commit 3d493f8 into isaac-sim:main Nov 6, 2025
8 of 9 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Isaac Lab Nov 6, 2025
koghalai123 pushed a commit to koghalai123/IsaacLab that referenced this pull request Dec 7, 2025
…aac-sim#3803)

# Description

This PR ensures all imports follows the string import style.
String import style avoid pulling of unnecessary packages that is
related to other environments, this pr makes sure all environments are
using this import.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Co-authored-by: Kelly Guo <kellyg@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Edify0991 pushed a commit to Edify0991/IsaacLab that referenced this pull request Jan 14, 2026
…aac-sim#3803)

# Description

This PR ensures all imports follows the string import style.
String import style avoid pulling of unnecessary packages that is
related to other environments, this pr makes sure all environments are
using this import.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Co-authored-by: Kelly Guo <kellyg@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants